package com.fourth.task;

import com.fourth.service.RoleService;
import lombok.extern.slf4j.Slf4j;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author Mr.ma
 * @since 2023/2/28 14:51
 **/
@Slf4j
public class RoleStateTask extends QuartzJobBean {

    @Resource
    private RoleService roleService;

    private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    @Override
    protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        int i = roleService.upStatusFromRedis2DB();
        log.info("RoleStateTask-------- {插入了" + i + "条数据}", sdf.format(new Date()));
    }
}
